package com.uzhie.web.service;

import com.uzhie.web.dao.PassengerDAO;
import com.uzhie.exception.UserException;
import com.uzhie.web.module.Passenger;
import org.apache.ibatis.session.RowBounds;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 客流量分析服务
 */
@Service
public class PassengerService {

    @Autowired
    PassengerDAO passengerDAO;

    /**
     * @param userId
     * @param vehicleNumber
     * @param startTime
     * @param endTime
     * @param rowBounds
     * @return
     */
    public List<Passenger> selectListByConidition(@NotEmpty(message = UserException.Status.ID_ISNULL) String userId, String vehicleNumber, String startTime, String endTime, RowBounds rowBounds) throws UserException {
        List<Passenger> list = null;
        try {
            list = passengerDAO.selectListByCondition(userId, vehicleNumber, startTime, endTime, rowBounds);
        } catch (Exception e) {
            throw new UserException(UserException.Status.POWER_ERROR);
        }
        return list;
    }
}
